package com.forlove.app.qselect.index.adapter;

import android.content.Context;
import android.graphics.Color;

import com.forlove.app.R;
import com.forlove.app.common.base.mvp.presenter.IBasePresenter;
import com.forlove.app.common.widget.recyview.BaseRecyclerAdapter;
import com.forlove.app.common.widget.recyview.ViewHolder;
import com.forlove.app.qselect.index.entity.RankEntity;

import java.util.List;

/**
 * Created by yjl on 2017/10/26.
 */

public class DetailRankAdapter extends BaseRecyclerAdapter<RankEntity> {
    public DetailRankAdapter(Context context, int itemView, List<RankEntity> mDatas, IBasePresenter presenter) {
        super(context, itemView, mDatas, presenter);
    }

    @Override
    protected void convertView(ViewHolder holder, RankEntity entity, int position) {
        if (position == 0) {
            holder.setBackgroundRes(R.id.text_rank_num, R.mipmap.icon_rank_one);
            holder.setTextColor(R.id.text_rank_num, Color.parseColor("#ffffff"));
        } else if (position == 1) {
            holder.setBackgroundRes(R.id.text_rank_num, R.mipmap.icon_rank_two);
            holder.setTextColor(R.id.text_rank_num, Color.parseColor("#ffffff"));
        } else if (position == 2) {
            holder.setBackgroundRes(R.id.text_rank_num, R.mipmap.icon_rank_three);
            holder.setTextColor(R.id.text_rank_num, Color.parseColor("#ffffff"));
        } else {
            holder.setBackgroundColor(R.id.text_rank_num, Color.parseColor("#ffffff"));
            holder.setTextColor(R.id.text_rank_num, R.color.str_color_gray);
        }
        holder.setText(R.id.text_rank_num, (position + 1) + "");

        holder.setText(R.id.text_subject_content, entity.mName);
        holder.setText(R.id.text_circle_account, entity.rankTimes + "");

    }
}
